<?php

declare(strict_types=1);

namespace ImiApp\ApiServer\Api\Model\Base;

use Imi\Config\Annotation\ConfigValue;
use Imi\Model\Annotation\Column;
use Imi\Model\Annotation\DDL;
use Imi\Model\Annotation\Entity;
use Imi\Model\Annotation\Table;
use ImiApp\ImiServer\AbstractModel as Model;

/**
 * 快递公司 基类.
 *
 * @Entity(camel=false, bean=true, incrUpdate=false)
 * @Table(name=@ConfigValue(name="@app.models.ImiApp\ApiServer\Api\Model\Express.name", default="fa_express"), usePrefix=false, id={"id"}, dbPoolName=@ConfigValue(name="@app.models.ImiApp\ApiServer\Api\Model\Express.poolName"))
 * @DDL(sql="CREATE TABLE `fa_express` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(60) DEFAULT NULL COMMENT '快递公司',
  `code` varchar(60) DEFAULT NULL COMMENT '编码',
  `weigh` int(11) NOT NULL DEFAULT '0' COMMENT '权重',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='快递公司'", decode="")
 *
 * @property int|null $id 
 * @property string|null $name 快递公司
 * @property string|null $code 编码
 * @property int|null $weigh 权重
 */
abstract class ExpressBase extends Model
{
    /**
     * {@inheritdoc}
     */
    public const PRIMARY_KEY = 'id';

    /**
     * {@inheritdoc}
     */
    public const PRIMARY_KEYS = ["id"];

    /**
     * id.
     * @Column(name="id", type="int", length=11, accuracy=0, nullable=false, default="", isPrimaryKey=true, primaryKeyIndex=0, isAutoIncrement=true, unsigned=false, virtual=false)
     * @var int|null
     */
    protected ?int $id = NULL;

    /**
     * 获取 id.
     *
     * @return int|null
     */
    public function getId(): ?int
    {
        return $this->id;
    }

    /**
     * 赋值 id.
     * @param int|null $id id
     * @return static
     */
    public function setId($id)
    {
        $this->id = null === $id ? null : (int)$id;
        return $this;
    }

    /**
     * 快递公司.
     * name
     * @Column(name="name", type="varchar", length=60, accuracy=0, nullable=true, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=false, virtual=false)
     * @var string|null
     */
    protected ?string $name = NULL;

    /**
     * 获取 name - 快递公司.
     *
     * @return string|null
     */
    public function getName(): ?string
    {
        return $this->name;
    }

    /**
     * 赋值 name - 快递公司.
     * @param string|null $name name
     * @return static
     */
    public function setName($name)
    {
        $this->name = null === $name ? null : (string)$name;
        return $this;
    }

    /**
     * 编码.
     * code
     * @Column(name="code", type="varchar", length=60, accuracy=0, nullable=true, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=false, virtual=false)
     * @var string|null
     */
    protected ?string $code = NULL;

    /**
     * 获取 code - 编码.
     *
     * @return string|null
     */
    public function getCode(): ?string
    {
        return $this->code;
    }

    /**
     * 赋值 code - 编码.
     * @param string|null $code code
     * @return static
     */
    public function setCode($code)
    {
        $this->code = null === $code ? null : (string)$code;
        return $this;
    }

    /**
     * 权重.
     * weigh
     * @Column(name="weigh", type="int", length=11, accuracy=0, nullable=false, default="0", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=false, virtual=false)
     * @var int|null
     */
    protected ?int $weigh = 0;

    /**
     * 获取 weigh - 权重.
     *
     * @return int|null
     */
    public function getWeigh(): ?int
    {
        return $this->weigh;
    }

    /**
     * 赋值 weigh - 权重.
     * @param int|null $weigh weigh
     * @return static
     */
    public function setWeigh($weigh)
    {
        $this->weigh = null === $weigh ? null : (int)$weigh;
        return $this;
    }

}
